package draw;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

public class DrawPanel extends JPanel {

    BufferedImage srcImage;

    public DrawPanel() {
    }

    public DrawPanel(BufferedImage srcImage) {
        this.srcImage = srcImage;
    }

    @Override
    protected void paintComponent(Graphics grphcs) {
        super.paintComponent(grphcs);

        Graphics2D g2 = (Graphics2D) grphcs;
        if (srcImage != null) {
            g2.drawImage(srcImage, 0, 0, null);
        }


    }

    public void setSrcImage(BufferedImage srcImage) {
        this.srcImage = srcImage;
        repaint();
    }

    public BufferedImage getSrcImage() {
        return srcImage;
    }

}
